package FilterPattern;

import java.util.ArrayList;
import java.util.List;

public class FilterPatternTest {
    public static void main(String[] args) {
        Person person1 = new Person("name1","male", "married");
        Person person2 = new Person("name2","female", "unmarried");
        Person person3 = new Person("name3","female", "married");
        Person person4 = new Person("name4","male", "unmarried");
        Person person5 = new Person("name5","male", "unmarried");
        Person person6 = new Person("name6","female", "married");
        Person person7 = new Person("name7","male", "unmarried");
        Person person8 = new Person("name8","female", "married");
        Person person9 = new Person("name9","male", "married");
        List<Person> persons = new ArrayList<Person>();
        persons.add(person1);
        persons.add(person2);
        persons.add(person3);
        persons.add(person4);
        persons.add(person5);
        persons.add(person6);
        persons.add(person7);
        persons.add(person8);
        persons.add(person9);

        CriteriaMale criteriaMale = new CriteriaMale();
        CriteriaMarrige criteriaMarrige = new CriteriaMarrige();
        //Criteria marriedMaleCriteria = new AndCriteria(criteriaMale, criteriaMarrige);
        Criteria marriedMaleCriteria = new OrCriteria(criteriaMale, criteriaMarrige);
        List<Person> people = marriedMaleCriteria.meetCriteria(persons);
        int k = 1;
        for(Person person : people){
            System.out.print("   "+ k + "= "+person.getName()+" ");
            k++;
        }
    }
}
